package com.dragon.repository.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.PaymentContract;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PaymentContractDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "收款主表id")
    private Integer paymentId;

    @ApiModelProperty(value = "合同id")
    private Integer contractId;

    @ApiModelProperty(value = "计划收款id")
    private Integer planId;

    @ApiModelProperty(value = "收款金额")
    private Double money;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "合同名称")
    private Date contractName;

    @ApiModelProperty(value = "应收金额")
    private Double planMoney;

    @ApiModelProperty(value = "实收金额")
    private Double actualPlanMoney;

    @ApiModelProperty(value = "平账状态：0否 1是")
    private Integer balancingAccounts;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "账单id")
    private Integer billId;

    @ApiModelProperty(value = "收款状态")
    private Integer paymentStatus;

    @ApiModelProperty(value = "客户名称")
    private Date customerName;


    public PaymentContractDTO() {}

    public PaymentContractDTO(PaymentContract entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static PaymentContractDTO convert(PaymentContract entity) {
        return new PaymentContractDTO(entity);
    }

    public static List<PaymentContractDTO> convertList(List<PaymentContract> list) {
        List<PaymentContractDTO> resultList = new ArrayList<>();
        for (PaymentContract entity : list) {
            resultList.add(new PaymentContractDTO(entity));
        }
        return resultList;
    }}
